<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2017/10/17 0017
  Time: 上午 10:42
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>添加</title>
    <link rel="stylesheet" href="/static/plugins/layui/css/layui.css">
    <link rel="stylesheet" href="/static/css/common.css">
    <link rel="stylesheet" href="/static/plugins/css/zTreeStyle/zTreeStyle.css" type="text/css">
</head>
<body>

    <div class="box-padding-15">
         <span class="layui-breadcrumb">
          <a href="#">首页>></a>
          <a href="javascript:;">门店管理>></a>
          <a><cite>增加页面</cite></a>
        </span>
        <hr>
        <div class="layui-tab">
            <ul class="layui-tab-title">
                <li class="layui-this">门店管理</li>
            </ul>
            <div class="layui-tab-content">
                <div class="layui-tab-item layui-show">
                    <div class="box-form">
                        <form class="layui-form "  method="post">
                            <div class="layui-form-item">
                                <label class="layui-form-label">门店名：</label>
                                <div class="layui-input-block">
                                    <input type="hidden" name="deptId" id="deptId">
                                    <input type="text" name="deptName" id="deptName" required  lay-verify="required"  autocomplete="off" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">电话：</label>
                                <div class="layui-input-block">
                                    <input type="text" name="deptPhone" id="deptPhone" required  lay-verify="required"  autocomplete="off" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">店长：</label>
                                <div class="layui-input-block">
                                    <input type="text" name="ownerName" id="ownerName" required  lay-verify="required"  autocomplete="off" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">手机：</label>
                                <div class="layui-input-block">
                                    <input type="text" name="ownerMobile" id="ownerMobile" required  lay-verify="required"  autocomplete="off" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">城市：</label>
                                <div class="layui-input-block">
                                    <input type="text" name="inCity" id="inCity" required  lay-verify="required"  autocomplete="off" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">地址：</label>
                                <div class="layui-input-block">
                                    <input type="text" name="address" id="address" required  lay-verify="required"  autocomplete="off" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">经度：</label>
                                <div class="layui-input-block">
                                    <input type="text" name="gpsLon" id="gpsLon" required  lay-verify="required"  autocomplete="off" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">纬度：</label>
                                <div class="layui-input-block">
                                    <input type="text" name="gpsLat" id="gpsLat" required  lay-verify="required"  autocomplete="off" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">备注：</label>
                                <div class="layui-input-block">
                                    <input type="text" name="remark" id="remark" required  lay-verify="required"  autocomplete="off" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <div class="layui-inline">
                                    <label class="layui-form-label">创建日期</label>
                                    <div class="layui-input-inline">
                                        <input type="text" class="layui-input" id="addTime" name="addTime">
                                    </div>
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <div class="layui-input-block">
                                    <button class="layui-btn" lay-submit lay-filter="formSubmit" id="submit">保存</button>
                                    <a href="/dept"><button type="button" class="layui-btn layui-btn-primary">取消</button></a>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>

            </div>
        </div>
    </div>


    <script src="/static/plugins/jquery-3.2.1.min.js"></script>
    <script src="/static/plugins/layui/layui.js"></script>
    <script src="/static/js/common.js"></script>
    <script>
        //加载模块
        layui.use(["form","element","layer",'laydate','upload'],function () {
            var form = layui.form;
            var laydate=layui.laydate;
            var upload=layui.upload;
            var layer=layui.layer;
            //加载时间
            var ins22 = laydate.render({
                elem: '#addTime'
                ,min: '2000-1-1'
                ,max: '2100-1-1'
                ,ready: function(){
                    ins22.hint('日期');
                }
            });
            //异步提交
            form.on("submit",function(data){
                $.ajax({
                    url:"/dept/save",
                    type:"post",
                    dataType:"json",
                    data:data.field,
                    success:function (rs) {
                        layer.msg(rs.message);
                        if(rs.code==1){
                            layer.msg("保存成功",{time:2000},function(){
                                location.href="/dept";
                            })
                        }else{
                           layer.msg("保存失败");
                        }
                    },
                    error:function(){
                    }
                })
                return false;   //阻止默认事件
            })
        })
    </script>
</body>
</html>
